# 根据路径一直滑动，直到找到需要点击的元素
def swipe_element(driver, by, value):
    # 设置隐式等待时间
    driver.implicitly_wait(2)
    while True:
        add_member = driver.find_elements(by, value)
        if len(add_member) < 1:
            # 获取屏幕的宽和高
            window_size = driver.get_window_size()
            # 从window_size中获取width的值
            width = window_size["width"]
            # 从window_size中获取height的值
            height = window_size["height"]
            # 宽度除以2,获取中心点位置
            startx = int(width / 2)
            # 从屏幕下方开始滑动
            starty = height * 0.8
            # 滑动结束的位置
            endy = height * 0.2
            # 滑动的时间(毫秒)
            duration = 200
            # 开始位置的坐标,滑动结束的坐标,滑动的时间
            driver.swipe(start_x=startx, start_y=starty, end_x=startx, end_y=endy, duration=duration)
        else:
            return add_member[0]



